#include <iostream>
#include <signal.h>

#include <unistd.h>

void sigcb(int signo)
{
    std::cout << "i get a signal: " << signo << std::endl;
    exit(1);
}
int main()
{
    // signal(2,sigcb);
    struct sigaction act,oact;
    act.sa_handler = sigcb;
    sigaction(2,&act,&oact);

    sigset_t block,oblock;
    sigemptyset(&block);
    sigemptyset(&oblock);
    sigaddset(&block,2);
    sigaddset(&block,40);
    sigprocmask(SIG_SETMASK,&block,&oblock);
    while(true)
    {
        pause();
    }
    return 0;
}